﻿using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace AMing.Extension.WindowsPhone8
{
    public static class ObservableCollectionExtension
    {
        public static void Sort<T>(this ObservableCollection<T> Collection, IComparer<T> comparer)
        {
            int i, j;
            T index;
            for (i = 1; i < Collection.Count; i++)
            {
                index = Collection[i];
                j = i;
                while ((j > 0) && (comparer.Compare(Collection[j - 1], index) == 1))
                {
                    Collection[j] = Collection[j - 1];
                    j = j - 1;
                }
                Collection[j] = index;
            }
        }
    }

}
